<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>员工请假记录显示</title>
<link href="css/common.css" rel="stylesheet">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="bootstrap/js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script  src="js/jquery.framewindow.js"></script>

</head>
<script type="text/javascript">
$(function(){
	//点击增加按钮，弹出增加员工考勤信息输入框
	$("#add").click(function(){
		$("#dataShow").hide();
		$("#addEmpAskoff").show();
	});
	//点击删除按钮，查询所有被选中的员工，并发送请求
	$("#del").click(function(){
		var tds=$("input:checked").parent().next();
		var sids="";
		$.each(tds,function(i){
			sids+=$(this).text()+",";
		});
		var newStr=sids.substring(0,sids.length-1);
		window.location.href="deleteEmpAskoff?sids="+newStr.trim();
	});
	//全选与全不选
	$("#SelectAll").click(function(){
		if(this.checked){
			$("input[name=checkbox]").prop("checked", true);
		}else{
			$("input[name=checkbox]").prop("checked", false);
		}
	});
});
</script>
<body>
<div class="container">
<div class="row">
	<div class="col-md-12">
	<div>
		<ol class="breadcrumb">
			<li><a  href="welcome.jsp">首页</a></li>
			<li>员工信息管理</li>
			<li>员工请假记录管理</li>
		</ol>
	</div>
	<div id="dataShow">
	<div>
		<button type="button" class="btn btn-primary" id="add">添加</button>
		<button type="button" class="btn btn-info" id="del">删除</button>
	</div>
	<hr>
    <c:choose>
   			 <c:when test="${!empty askoffDtos}">
                 <h3>员工请假记录展示</h3>
    			</c:when>
    		<c:otherwise>
      			  <h3>对不起,该部门还没有员工请假记录</h3>
   			 </c:otherwise>
		</c:choose>
	<table  class="table table-striped" id="table" >
	<tr class="active">
	<td>编号</td>
	 <td><input type="checkbox" id="SelectAll"></td>
	 <td style="display: none">ID</td>
	 <td>姓名</td>
	 <td>请假开始时间</td>
	 <td>请假结束时间</td>
	 <td>请假天数</td>
	 <td>请假原因</td>
	</tr>
	<c:forEach var="askoffDto" items="${askoffDtos}" varStatus="vs">
	<tr>
	<td>${vs.count}</td>
	<td><input type="checkbox" name="checkbox"></td>
	<td style="display: none">${askoffDto.id}</td>
	<td>${askoffDto.name}</td>
	<td>${askoffDto.startDate}</td>
	<td>${askoffDto.endDate}</td>
	<td>${askoffDto.days}</td>
	<td>${askoffDto.reason}</td>
	</tr>
	</c:forEach>
		</table>
		 <div>
		  <ul class="pagination">
			      ${pageList}
  		  </ul>
  		  <h3>${erro}</h3>
  		  </div>
	</div>
	</div>
	<!-- 增加员工请假记录信息输入框 -->
	<div id="addEmpAskoff" style="position: absolute;display: none;margin-top: 75px" class="col-md-6 col-md-offset-2">
	<form action="addEmpAskoff" method="post" class="form-horizontal">
	<div class="form-group">
    		 <label for="addaccount">工号</label>
             <input type="text" class="form-control" id="addaccount" name="addaccount" placeholder="输入工号">
             </div>
         <div class="form-group">
             <label for="addstartdate">请假开始时间</label>
             <input type="text" class="form-control" id="addstartdate" name="addstartdate" placeholder="输入请假开始时间">
         </div>
         <div class="form-group">
             <label for="addenddate">请假结束时间</label>
             <input type="text" class="form-control" id="addenddate" name="addenddate" placeholder="输入请假结束时间">
         </div>
         <div class="form-group">
             <label for="adddays">请假天数</label>
             <input type="text" class="form-control" id="adddays" name="adddays" placeholder="输入请假天数">
         </div>
         <div class="form-group">
             <label for="addreason">请假原因</label>
             <input type="text" class="form-control" id="addreason" name="addreason" placeholder="输入请假原因">
         </div>
             <button id="addsubmit" type="submit" class="btn btn-default">提交</button>
	</form>
	</div>
	</div>
	</div>
</body>
</html>